<?php

include 'admin/Util.php';

require_once('recaptcha-php-1.11/recaptchalib.php');
$privatekey = Constants::$privateKey;
$resp = recaptcha_check_answer ($privatekey,
    $_SERVER["REMOTE_ADDR"],
    $_POST["recaptcha_challenge_field"],
    $_POST["recaptcha_response_field"]);

if (!$resp->is_valid) {
// What happens when the CAPTCHA was entered incorrectly
    die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
        "(reCAPTCHA said: " . $resp->error . ")");
} else {
    $message = $_POST['text'] . "\r\n\r\n".' from '.$_POST['email'];

    // In case any of our lines are larger than 70 characters, we should use wordwrap()
    $to = 'info@fibix.org';
    $message = wordwrap($message, 70);
    $headers = 'From: '. $_POST['email'] . "\r\n" .
    'Reply-To: '. $to . "\r\n" .
    'X-Mailer: PHP/' . phpversion();
    Util::sendMailToFull('info@fibix.org','MESSAGE FROM WEB '.$_POST['subject'],$message, $headers);
    echo "Your message was successfully send. <a href='contacts.php'> BACK </a>";
// Your code here to handle a successful verification
}//info@fibix.org
?>
